#include <stdio.h>
// 自定义结构体类型
struct Student
{
    int id;
    char *name;
    int age;
    char *gender;
    char *address;
};
//值传递
void showInfo_1(struct Student stu){
    printf("id: %d \n", stu.id);
    printf("name: %s \n", stu.name);
    printf("age: %d \n", stu.age);
    printf("gender: %s \n", stu.gender);
    printf("address: %s \n ", stu.address);
    
}
//指针传递
void showInfo_2(struct Student *ptr){
    printf("id: %d \n", ptr->id);
    printf("name: %s \n", ptr->name);
    printf("age: %d \n", ptr->age);
    printf("gender: %s \n", ptr->gender);
    printf("address: %s \n ", ptr->address);
    
}

int main(void)
{
    // 自定义结构体类型的变量
    struct Student stu1;
    stu1.id = 100;
    stu1.name = "Tom";
    stu1.age = 18;
    stu1.gender = "男";
    stu1.address = "南京市宣武区徐庄软件园";
    printf("sizeof stu1:%ld\n",sizeof(stu1));

    struct Student stu2;
    stu2.id = 101;
    stu2.name = "Pom";
    stu2.age = 19;
    stu2.gender = "女";
    stu2.address = "南京市宣武区徐庄软件园";
    printf("sizeof stu2:%ld\n",sizeof(stu2));


    // 访问结构体变量的属性
    printf("id: %d \n", stu1.id);
    printf("name: %s \n", stu1.name);
    printf("age: %d \n", stu1.age);
    printf("gender: %s \n", stu1.gender);
    printf("address: %s \n ", stu1.address);
    showInfo_2(&stu2);//传指针
    return 0;
}